﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace devtm.AutoMapper
{
    /// <summary>
    /// Interaction logic for ModelDetailExplorer.xaml
    /// </summary>
    [CLSCompliant(false)]
    public partial class ModelDetailExplorer : UserControl
    {


        private MapperContainers container;

        global::System.IServiceProvider serviceProvider;

        public ModelDetailExplorer(global::System.IServiceProvider serviceProvider)
        {
            
            InitializeComponent();
            this.serviceProvider = serviceProvider;
            container = new MapperContainers(serviceProvider);

            RootElement.Items.Add(container);
        }

        public AutomapperDetailsToolWindows Datas { get; set; }


        internal void RefreshList(Microsoft.VisualStudio.Modeling.Shell.ModelingDocView modelingDocView)
        {

            if (modelingDocView == null)
                return;

            MappingModel root = modelingDocView.DocData.RootElement as MappingModel;

            

            try
            {

                container.Header = (((Microsoft.VisualStudio.Modeling.Shell.SingleDiagramDocView)modelingDocView).Diagram).Name;

                if (root == null)
                    return;

                container.Refresh(root);

            }
            catch (Exception)
            {
                throw;
            }
          
        }


    }
}
